/**
 * 
 */
package com.es.dao;


import java.util.Hashtable;

import org.apache.log4j.Logger;

import com.es.dao.factory.SqlMapClientFactory;
import com.es.exception.dao.ESDataAccessException;
import com.es.model.SalesWorkForce;
import com.ibatis.sqlmap.client.SqlMapClient;


/**
 * @author Bushra Nazir
 *
 */
public class SalesWorkForceDAO extends BaseDAO {

	private static final Logger log = Logger.getLogger(SalesWorkForceDAO.class);
	
	
	/*
	 * author Bushra
	 * @param String usercode, String password
	 * @return SalesWorkForce
	 */
	public SalesWorkForce getUserByUserCodeAndPassword(String code, String password) {
		SalesWorkForce salesWorkForce = null;
		
		log.info(" inside getUserByUserCodeAndPassword() "); 
		
		log.info("USER-CODE :: " + code);
		log.info("USER-PSWD :: " + password);
		
		Hashtable<String , String > paramMap = new Hashtable<String, String> ();
		paramMap.put("code", code);
		paramMap.put("pswd", password);
		
		
		SqlMapClient sqlMap =  SqlMapClientFactory.getSqlMapClient();

		try {
			salesWorkForce = (SalesWorkForce) sqlMap.queryForObject("salesworkforce.selectByUserCodeAndPassword",paramMap);
			log.info("USER PASSWORD::" + salesWorkForce.getUsercode());
			log.info("USER PASSWORD::" + salesWorkForce.getPassword());
			return salesWorkForce;
		}catch (Exception e) {
			log.error(e);
			throw new ESDataAccessException(e);

		}
	}

}
